﻿using System.Data.Entity;
using Tisbi.LawFirm.DAL.Models;

namespace Tisbi.LawFirm.DAL
{
    public class LawContext : DbContext
    {
        public LawContext(string connectionString)
            : base(connectionString)
        {
            //Configuration.ProxyCreationEnabled = false;
        }

        public DbSet<Customers> Customers { get; set; }
        public DbSet<Employees> Employees { get; set; }
        public DbSet<Lawsuits> Lawsuits { get; set; }
        public DbSet<Cases> Cases { get; set; }
        public DbSet<Court> Courts { get; set; }
        public DbSet<District> District { get; set; }
        public DbSet<CourtType> CourtTypes { get; set; }
        public DbSet<StatementOfClaimType> StatementOfClaimTypes { get; set; }
        public DbSet<CourtEmployees> CourtEmployees { get; set; }
        public DbSet<Jurisdiction> Jurisdiction { get; set; }
        public DbSet<Claims> Claims { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<LawContext>());
            base.OnModelCreating(modelBuilder);

            // место для вызовов Entity Framework Fluent API
            // modelBuilder.Entity<Customers>().HasKey(e => e.Id);


        }
    } 
}
